package com.synnex.salesorderportal.dao.entity;

import lombok.*;

import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.sql.Timestamp;

/**
 * Created by yachao on 18/5/31.
 */
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "order_detail")
public class OrderDetail implements Serializable{
    private static final long serialVersionUID = -3186901517349608595L;

    @EmbeddedId
    private OrderDetailId id;

    @Column(name = "entry_datetime")
    private Timestamp entryDateTime;

    public OrderDetail(Integer orderType, Integer orderNo, Integer orderLineNo, Timestamp entryDateTime) {
        this.id = new OrderDetailId(orderType, orderNo, orderLineNo);
        this.entryDateTime = entryDateTime;
    }

    @Override
    public String toString() {
        return "OrderDetail{" +
                "id=" + id +
                ", entryDateTime=" + entryDateTime +
                '}';
    }
}
